
/**
* 
* ====================================================================
*
* @author apov <apov@ymail.com>
*/ 
// UserManager.h
//

#pragma once

#include <BaseDefine.h>
#include <KeyValueManager.h>
#include "User.h"

/**
* @class UserManager
*  - UserManager class 
*/
class UserManager{
	typedef KeyValueManager< size_t, User* > Numeric;
	typedef KeyValueManager< std::string, User* > Str;	

public:
	virtual void removeUser( const size_t ident ) = 0;
	virtual void removeUser( User* user ) = 0;
	virtual int broadcast_this_contents( char* data ) = 0;

	size_t size();	

	User* get( size_t ident );
	User* get( char* id );	

	bool add( User* user );
	bool user_just_login( User* user );	

	int broadcast_all( char* data, size_t size );
	int broadcast( char* data, size_t size );	

	UserManager();
	virtual ~UserManager();

protected:
	void remove( User* user );	

	Numeric numeric_key_;
	Str str_key_;	

private:
};
